home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / libsrc~1.z / libsrc~1 / stcrtso.cpp < prev    next >
Encoding:
Text File  |  1989-12-28  |  709 b   |  37 lines

  1. #
  2. | This is the C run-time start-off routine.  It's job is to take the
  3. | arguments as put on the stack by EXEC, and to parse them and set them up the
  4. | way _main expects them.
  5.  
  6. | public labels
  7.     .globl    _environ
  8. | external references
  9.     .globl    __main
  10.     .globl    _exit
  11.     .globl    _etext
  12.     .globl    _edata
  13.     .globl    _end
  14.     .text
  15.     .even
  16. start:    
  17.     movl    sp,a0
  18.     movl    a0@+,d0    | .long due to lib/exec.c and mm/exec.c
  19.     movl    d0,d1
  20.     addl    #1,d1
  21.     asll    #2,d1        | pointers are four .bytes on 68000
  22.     movl    a0,a1
  23.     addl    d1,a1
  24.     movl    a1,_environ    | save envp in environ
  25.     movl    a1,sp@-    | push environ
  26.     movl    a0,sp@-    | push argv
  27.     movl    d0,sp@-    | push argc
  28.     jsr    __main
  29.     addw    #12,sp
  30.             | should never come here
  31. L0:    jra    L0
  32.  
  33.     .data
  34.     .even
  35. _environ:
  36.     .long    0
  37.